/**
 * Created by zby on 2018/4/16.
 */
abstract class Data {
    abstract public void DisplayValue();
}

class Integer extends Data {
    int value;

    Integer() {
        value = 100;
    }

    public void DisplayValue() {
        System.out.println(value);
    }
}

class Byte extends Data {
    byte value;

    Byte() {
        value = (byte) 20165218;
    }

    public void DisplayValue() {
        System.out.println(value);
    }
}

// Pattern Classes
abstract class Factory {
    abstract public Data CreateDataObject();
}

class IntFactory extends Factory {
    public Data CreateDataObject() {
        return new Integer();
    }
}

class ByteFactory extends Factory {
    public Data CreateDataObject() {
        return new Byte();
    }
}

//Client classes
class Document {
    Data data;

    Document(Factory factory) {
        data = factory.CreateDataObject();
    }

    public void DisplayData() {
        data.DisplayValue();

    }
}
